<html>
<head>

<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">

<script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>

<script type="text/javascript" language="javascript" class="init">

jQuery.fn.dataTableExt.oApi.fnGetHiddenNodes = function ( settings )
{
    var nodes;
    var display = jQuery('tbody tr', settings.nTable);
 
    if ( jQuery.fn.dataTable.versionCheck ) {
        // DataTables 1.10
        var api = new jQuery.fn.dataTable.Api( settings );
        nodes = api.rows().nodes().toArray();
    }
    else {
        // 1.9-
        nodes = this.oApi._fnGetTrNodes( settings );
    }
 
    /* Remove nodes which are being displayed */
    for ( var i=0 ; i<display.length ; i++ ) {
        var iIndex = jQuery.inArray( display[i], nodes );
 
        if ( iIndex != -1 ) {
            nodes.splice( iIndex, 1 );
        }
    }
 
    return nodes;
};

$(document).ready(function() {
   oTable = $('#product_table').dataTable();
    
   $('form').submit(function(){
      $(oTable.fnGetHiddenNodes()).find('input:text').appendTo(this);
   });
} );


	</script>
</head>
<body>
<div class="box span12">
  <div class="box-header" data-original-title>
    <h2><i class="icon-user"></i><span class="break"></span>Products List</h2>
    <div class="box-icon"> <a href="#" class="btn-setting"><i class="icon-wrench"></i></a> <a href="#" class="btn-minimize"><i class="icon-chevron-up"></i></a> <a href="#" class="btn-close"><i class="icon-remove"></i></a> </div>
  </div>
  <div class="box-content">
    <form action="/products/save-product-order" method="post">
      <table border="1" id="product_table">
        <thead>
          <tr>
            <th rowspan="2" scope="col"><input type="checkbox" name="check_all" id="check_all" />
              All</th>
            <th rowspan="2" scope="col">Barcode</th>
            <th rowspan="2" scope="col">Title</th>
            <th colspan="4" scope="col" style="text-align:center">Stock</th>
            <th scope="col" style="text-align:center">ebay Ready</th>
            <th style="text-align:center" scope="col">Web Ready</th>
            <th rowspan="2" style="text-align:center" scope="col">Action</th>
          </tr>
          <tr>
            <td>Wh</td>
            <td>Old</td>
            <td>New</td>
            <td>Total</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </thead>
        <tbody>
          <?php
if(!empty($this->pList)){
 	foreach($this->pList as $v) {?>
          <tr>
            <td><input type="checkbox" name="id_product[]" id="id_product<?=$v["id_product"]?>" value="<?=$v["id_product"]?>" /></td>
            <td><?=$v["code_product"]?></td>
            <td><?=$v["title_product"]?></td>
            <td><?=$v["stock_wh"]?></td>
            <td><?=$v["stock_shop_old"]?></td>
            <td><?=$v["stock_shop_new"]?></td>
            <td><? echo $v["stock_wh"] + $v["stock_shop_old"] + $v["stock_shop_new"] ?></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td><button class="btn btn-small" data-rel="tooltip" title="Remove" data-original-title="Hide Product"> <i class="icon-trash"></i> Remove</button></td>
          </tr>
          <?php 
 	}
}?>
        </tbody>
      </table>
      <button  type="submit" class="btn btn-small btn-inverse" id="btn_add_to_order"  name ="btn_add_to_order"  >Add to Order List </button>
      &nbsp;
      <button  type="submit" class="btn btn-small btn-inverse" id="btn_new_order" name="btn_new_order" >New Order List</button>  
      
    </form>
  </div>
</div>
</body>
</html>